package com.kuanter.kuanterauto.wapalipay;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.kuanter.kuanterauto.R;
import com.kuanter.kuanterauto.constants.MainConstants;


public class WapPayActivity extends Activity {
	WebView webView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.wap);
		/*Map<String,String> map = new HashMap<String, String>();
		map.put("subject", "测试");
		map.put("total_fee", "0.001");
		map.put("trade_no", System.currentTimeMillis()+"");*/
		//支付宝网页支付	方法名：cardRecharge/{cardNumber}/{rechargeAmount}/{mobileNumber}/trade		参数名：cardNumber，rechargeAmount，mobileNumber
		Intent intent = getIntent();
		String cardNumber = intent.getStringExtra("cardNumber");
		String rechargeAmount = intent.getStringExtra("rechargeAmount");
		String mobileNumber = intent.getStringExtra("mobileNumber");
//		webView.loadUrl("http://192.168.0.38:8080/App.v2/cardRecharge/"+cardNumber+"/"+rechargeAmount+"/trade") ;
		
		/*webView.setWebViewClient(new WebViewClient() {

			@Override
			public boolean shouldOverrideUrlLoading(WebView view, String url) {
				webView.loadUrl(url);
				return super.shouldOverrideUrlLoading(view, url);
			}
			
		});*/
		
		webView = (WebView) this.findViewById(R.id.webView) ;
		webView.requestFocusFromTouch(); 
		WebSettings webSettings = webView.getSettings();
		webSettings.setJavaScriptEnabled(true);
		webSettings.setUseWideViewPort(false);
		webSettings.setSupportZoom(true);
		/*WebViewClient webViewClient = new WebViewClient(){
			@Override
			public void doUpdateVisitedHistory(WebView view, String url,
					boolean isReload) {
				// TODO Auto-generated method stub
				super.doUpdateVisitedHistory(view, url, isReload);
			}
		};*/
		webView.setWebViewClient(new WebViewClient(){
			@Override
			public boolean shouldOverrideUrlLoading(WebView view, String url) {
				// TODO Auto-generated method stub
				return super.shouldOverrideUrlLoading(view, url);
			}
		});
//		webViewClient.onPageFinished(webView, "http://e.weibo.com/kuanter");
//		webView.loadUrl("http://e.weibo.com/kuanter?type=0");
		//支付宝网页支付	方法名：cardRecharge/{cardNumber}/{rechargeAmount}/{mobileNumber}/trade		参数名：cardNumber，rechargeAmount，mobileNumber
		webView.loadUrl(MainConstants.HOST_test+"cardRecharge/"+cardNumber+"/"+rechargeAmount+"/"+mobileNumber+"/trade") ;
	}
	
}